// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_SALES_SHIP
// * CreateDate    : 2014-03-27 22:08:57
// * Creater       : CodeSmith
// * LastChangeDate: 2014-03-27 22:08:57
// * LastChanger   : 2014-03-27 22:08:57
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Sales
{
/// <summary>
    /// SalesShip
    /// </summary>
    public partial class SalesShipBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objSalesShipEntity">Entity</param>
        /// <returns>Entity</returns>
        public static SalesShipEntity GetSalesShip(SalesShipEntity objSalesShipEntity)
        {
            return DataAccess.SelectSingle<SalesShipEntity>(objSalesShipEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objSalesShipEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertSalesShip(SalesShipEntity objSalesShipEntity)
        {
            return DataAccess.Insert(objSalesShipEntity);
        }

        public static bool InsertSalesShip(List<SalesShipEntity> objSalesShipEntityList)
        {
            return DataAccess.Insert(objSalesShipEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objSalesShipEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateSalesShip(SalesShipEntity objSalesShipEntity)
        {
            return DataAccess.Update(objSalesShipEntity);
        }

        public static bool UpdateSalesShip(List<SalesShipEntity> objSalesShipEntityList)
        {
            return DataAccess.Update<SalesShipEntity>(objSalesShipEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objSalesShipEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteSalesShip(SalesShipEntity objSalesShipEntity)
        {
            return DataAccess.Delete(objSalesShipEntity);
        }

        public static bool DeleteSalesShip(List<SalesShipEntity> objSalesShipEntityList)
        {
            return DataAccess.Delete<SalesShipEntity>(objSalesShipEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetSalesShipAll()
        {
            return DataAccess.SelectAllDataSet<SalesShipEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<SalesShipEntity> GetSalesShipAllList()
        {
            return DataAccess.SelectAll<SalesShipEntity>();
        }
        #endregion

        public static List<SalesShipEntity> GetSalesShipForCustomerSummary(List<string> salesAppIdList)
        {
            string sql = @"select * from SALES_SHIP ship where ship.IS_ACTIVE=1 and ship.STATUS='WFS35' and ship.SALES_APP_ID in ({0})";
            string sql2 = "";
            foreach (string appId in salesAppIdList)
            {
                sql2 += "'" + appId + "',";
            }
            sql2 = sql2.Substring(0, sql2.Length - 1);
            sql = string.Format(sql, sql2);
            return DataAccess.Select<SalesShipEntity>(sql);
        }

	}
	
	
}	

